package com.momoauth.api_client.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.momoauth.api_client.entity.MoMo_Dist_Type;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DistTypeMapper extends BaseMapper<MoMo_Dist_Type> {

    /**
     * 数据字典列表
     * @param page
     * @param wrapper
     * @return
     */
    @Select("SELECT id,code,name,type,status,description,createTime FROM momo_dist_type ${ew.customSqlSegment}")
    List<MoMo_Dist_Type> getDistTypeList(Page<MoMo_Dist_Type> page, @Param(Constants.WRAPPER) QueryWrapper wrapper);

    /**
     * 查找是否存在同名编号
     * @param code
     * @return
     */
    @Select("SELECT 1 FROM momo_dist_type WHERE code = #{code} LIMIT 1")
    Integer existDistTypeCode(String code);
}
